unit SmallStruct.Form.TSSFrame;

interface

uses
  Windows,
  Messages,
  SysUtils,
  Variants,
  Classes,
  Graphics,
  Controls,
  Forms,
  SmallStruct.Core;

type
  TSSFrame = class(TFrame, ISSRuntimeObject)
  private
    _Context: ISSObjectContext;
  protected { ISSObject }
    function GetObjectInstance: TComponent;
    procedure ReleaseObjectInstance;
  public { ISSRuntimeObject }
    function GetContext: ISSObjectContext; virtual;
    procedure SetContext(AObjectContext: ISSObjectContext); virtual;
    procedure InitObject; virtual;
  public
    constructor Create(AOwner: TComponent); override;
    destructor Destroy; override;
  end;

implementation

{$R *.dfm}

{ TSSFrame }

constructor TSSFrame.Create(AOwner: TComponent);
begin
  Name := '';
  inherited;
end;

destructor TSSFrame.Destroy;
begin
  if Assigned(_Context) then
    _Context.ReleaseObjectInstance;
  inherited;
end;

function TSSFrame.GetContext: ISSObjectContext;
begin
  Result := _Context;
end;

function TSSFrame.GetObjectInstance: TComponent;
begin
  Result := Self;
end;

procedure TSSFrame.InitObject;
begin

end;

procedure TSSFrame.ReleaseObjectInstance;
begin
  Free;
end;

procedure TSSFrame.SetContext(AObjectContext: ISSObjectContext);
begin
  _Context := AObjectContext;
end;

end.
